package com.xfmax.textcomponent;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ScrollView;

import com.xfmax.textcomponent.animator.AnimTools;
import com.xfmax.textcomponent.item.ChildItem;
import com.xfmax.textcomponent.item.Item;
import com.xfmax.textcomponent.taskContain.BaseLayout;

import java.util.ArrayList;
import java.util.List;

import static com.xfmax.textcomponent.animator.AnimTools.SLIDE_OUTLEFT_INRIGHT;

public class MainActivity extends AppCompatActivity {
    private BaseLayout layout_event_task;
    private BaseLayout layout_daily_task;
    private ScrollView scroll_contain;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        scroll_contain = (ScrollView) findViewById(R.id.scroll_contain);
        layout_event_task = (BaseLayout) findViewById(R.id.contain_event_task);
        layout_daily_task = (BaseLayout) findViewById(R.id.contain_daily_task);

        mockData();
    }

    public void off(View view) {
        AnimTools.play(SLIDE_OUTLEFT_INRIGHT,scroll_contain);
    }


    private void mockData() {
        List<ChildItem> childItemList = new ArrayList<>();
        ChildItem childItem1 = new ChildItem();
        childItem1.setTitle("十一期完成10单");
        childItem1.setArtiveValue("活跃值：+10");
        childItem1.setCompleteStatus("已完成");
        childItemList.add(childItem1);
        ChildItem childItem2 = new ChildItem();
        childItem2.setTitle("一天之内完成10单");
        childItem2.setArtiveValue("活跃值：+5");
        childItem2.setCompleteStatus("已完成");
        childItemList.add(childItem2);
        ChildItem childItem3 = new ChildItem();
        childItem3.setTitle("抢x次预约订单");
        childItem3.setArtiveValue("活跃值：-10");
        childItem3.setCompleteStatus("已完成");
        childItemList.add(childItem3);
        ChildItem childItem4 = new ChildItem();
        childItem4.setTitle("成功结算一次");
        childItem4.setArtiveValue("活跃值：+9");
        childItem4.setCompleteStatus("已完成");
        childItemList.add(childItem4);

        Item item = new Item();
        item.setParentTitle("活动任务获取：60");
        item.setChildItem(childItemList);

        layout_event_task.addItem(item);


        List<ChildItem> childItemList1 = new ArrayList<>();
        ChildItem childItem11 = new ChildItem();
        childItem11.setTitle("十一期完成10单");
        childItem11.setArtiveValue("活跃值：+10");
        childItem11.setCompleteStatus("已完成");
        childItemList1.add(childItem11);
        ChildItem childItem21 = new ChildItem();
        childItem21.setTitle("一天之内完成10单");
        childItem21.setArtiveValue("活跃值：+5");
        childItem21.setCompleteStatus("已完成");
        childItemList1.add(childItem21);
        ChildItem childItem31 = new ChildItem();
        childItem31.setTitle("抢x次预约订单");
        childItem31.setArtiveValue("活跃值：-10");
        childItem31.setCompleteStatus("已完成");
        childItemList1.add(childItem31);
        ChildItem childItem41 = new ChildItem();
        childItem41.setTitle("成功结算一次");
        childItem41.setArtiveValue("活跃值：+9");
        childItem41.setCompleteStatus("已完成");
        childItemList1.add(childItem41);

        Item item1 = new Item();
        item1.setParentTitle("每日任务获取：130");
        item1.setChildItem(childItemList1);

        layout_daily_task.addItem(item1);
    }


}
